package sudroid.json;

import java.util.Iterator;

public class HTTP
{
  public static final String CRLF = "\r\n";

  public static JSONObject toJSONObject(String paramString)
    throws JSONException
  {
    JSONObject localJSONObject1 = new JSONObject();
    HTTPTokener localHTTPTokener = new HTTPTokener(paramString);
    String str1 = localHTTPTokener.nextToken();
    if (str1.toUpperCase().startsWith("HTTP"))
    {
      JSONObject localJSONObject2 = localJSONObject1.put("HTTP-Version", str1);
      String str2 = localHTTPTokener.nextToken();
      JSONObject localJSONObject3 = localJSONObject1.put("Status-Code", str2);
      String str3 = localHTTPTokener.nextTo(0);
      JSONObject localJSONObject4 = localJSONObject1.put("Reason-Phrase", str3);
      int i = localHTTPTokener.next();
    }
    while (true)
    {
      if (!localHTTPTokener.more())
      {
        return localJSONObject1;
        JSONObject localJSONObject5 = localJSONObject1.put("Method", str1);
        String str4 = localHTTPTokener.nextToken();
        JSONObject localJSONObject6 = localJSONObject1.put("Request-URI", str4);
        String str5 = localHTTPTokener.nextToken();
        JSONObject localJSONObject7 = localJSONObject1.put("HTTP-Version", str5);
        continue;
      }
      String str6 = localHTTPTokener.nextTo(58);
      int j = localHTTPTokener.next(58);
      String str7 = localHTTPTokener.nextTo(0);
      JSONObject localJSONObject8 = localJSONObject1.put(str6, str7);
      int k = localHTTPTokener.next();
    }
  }

  public static String toString(JSONObject paramJSONObject)
    throws JSONException
  {
    Iterator localIterator = paramJSONObject.keys();
    StringBuffer localStringBuffer1 = new StringBuffer();
    if ((paramJSONObject.has("Status-Code")) && (paramJSONObject.has("Reason-Phrase")))
    {
      String str1 = paramJSONObject.getString("HTTP-Version");
      StringBuffer localStringBuffer2 = localStringBuffer1.append(str1);
      StringBuffer localStringBuffer3 = localStringBuffer1.append(32);
      String str2 = paramJSONObject.getString("Status-Code");
      StringBuffer localStringBuffer4 = localStringBuffer1.append(str2);
      StringBuffer localStringBuffer5 = localStringBuffer1.append(32);
      String str3 = paramJSONObject.getString("Reason-Phrase");
      StringBuffer localStringBuffer6 = localStringBuffer1.append(str3);
      StringBuffer localStringBuffer7 = localStringBuffer1.append("\r\n");
    }
    while (true)
    {
      if (!localIterator.hasNext())
      {
        StringBuffer localStringBuffer8 = localStringBuffer1.append("\r\n");
        return localStringBuffer1.toString();
        if ((paramJSONObject.has("Method")) && (paramJSONObject.has("Request-URI")))
        {
          String str4 = paramJSONObject.getString("Method");
          StringBuffer localStringBuffer9 = localStringBuffer1.append(str4);
          StringBuffer localStringBuffer10 = localStringBuffer1.append(32);
          StringBuffer localStringBuffer11 = localStringBuffer1.append(34);
          String str5 = paramJSONObject.getString("Request-URI");
          StringBuffer localStringBuffer12 = localStringBuffer1.append(str5);
          StringBuffer localStringBuffer13 = localStringBuffer1.append(34);
          StringBuffer localStringBuffer14 = localStringBuffer1.append(32);
          String str6 = paramJSONObject.getString("HTTP-Version");
          StringBuffer localStringBuffer15 = localStringBuffer1.append(str6);
          break;
        }
        throw new JSONException("Not enough material for an HTTP header.");
      }
      String str7 = localIterator.next().toString();
      if ((str7.equals("HTTP-Version")) || (str7.equals("Status-Code")) || (str7.equals("Reason-Phrase")) || (str7.equals("Method")) || (str7.equals("Request-URI")) || (paramJSONObject.isNull(str7)))
        continue;
      StringBuffer localStringBuffer16 = localStringBuffer1.append(str7);
      StringBuffer localStringBuffer17 = localStringBuffer1.append(": ");
      String str8 = paramJSONObject.getString(str7);
      StringBuffer localStringBuffer18 = localStringBuffer1.append(str8);
      StringBuffer localStringBuffer19 = localStringBuffer1.append("\r\n");
    }
  }
}

/* Location:           D:\Program Files\eclipse\apktool-r01-3\新浪微博\classes.dex.dex2jar.jar
 * Qualified Name:     sudroid.json.HTTP
 * JD-Core Version:    0.6.0
 */